package org.richin.script.util;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineFactory;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import static java.lang.System.*;
public class test1 {

	/**
	 * @param args
	 * @throws ScriptException 
	 */
	public static void main(String[] args) throws ScriptException {
		// 下面的代码将会打印出当前的 JDK 所支持的所有脚本引擎 
		ScriptEngineManager factory1 = new ScriptEngineManager(); 
		for (ScriptEngineFactory factory : factory1.getEngineFactories()) { 
			{
				// 打印脚本信息
				out.printf("Name: %s%n" +
"Version: %s%n" +
"Language name: %s%n" +
"Language version: %s%n" +
"Extensions: %s%n" +
				"Mime types: %s%n" +
				"Names: %s%n",
				factory.getEngineName(),
				factory.getEngineVersion(),
				factory.getLanguageName(),
				factory.getLanguageVersion(),
				factory.getExtensions(),
				factory.getMimeTypes(),
				factory.getNames());
				// 得到当前的脚本引擎
				ScriptEngine engine = factory.getScriptEngine();
				}
	     ScriptEngineManager factory12 = new ScriptEngineManager(); 
	        ScriptEngine engine = factory12.getEngineByName ("JavaScript"); 
	        engine.eval("print('Hello World')"); 
	}


}}